//
//  CTYuEViewController.m
//  CT
//
//  Created by liufanwei on 15/4/8.
//  Copyright (c) 2015年 liufanwei. All rights reserved.
//

#import "CTYuEViewController.h"
#import "CTNetHelper.h"
#import "CTUserDefaultHelper.h"
#import "BDKNotifyHUD.h"
#import "CommonMicro.h"

@interface CTYuEViewController ()
@property (weak, nonatomic) IBOutlet UILabel *JiFen;
@property (weak, nonatomic) IBOutlet UILabel *YuE;
@property (weak, nonatomic) IBOutlet UILabel *Time;
@property (weak, nonatomic) IBOutlet UIView *SmallBg;

@end

@implementation CTYuEViewController
@synthesize JiFen=_JiFen;
@synthesize Time=_Time;
@synthesize SmallBg=_SmallBg;
@synthesize YuE=_YuE;

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _SmallBg.clipsToBounds = YES;
    _SmallBg.layer.cornerRadius = 3.0;
    _SmallBg.layer.borderColor = [UIColor grayColor].CGColor;
    _SmallBg.layer.borderWidth = 1.0f;
    _SmallBg.backgroundColor = [UIColor whiteColor];
    
    _JiFen.textColor = kRGB(151, 181, 153);
    _YuE.textColor = kRGB(151, 181, 153);
    _Time.textColor = kRGB(151, 181, 153);
    _Constraint.constant = 2;
    
    NSString * account = [[CTUserDefaultHelper ShareInstance] Account];
    [[CTNetHelper ShareInstance] remainingMoney:@{@"account":account} WithCallBack:^(id data) {
        if ([[data objectForKey:@"code"] integerValue] == 0) {
            NSString * integral = [data objectForKey:@"integral"];
            if ([integral isKindOfClass:[NSNull class]]) {
                _JiFen.text = @"0";
            }else{
                _JiFen.text = integral;
            }
            NSString * money = [data objectForKey:@"money"];
            if ([money isKindOfClass:[NSNull class]]) {
                _YuE.text = @"0";
            }else{
                _YuE.text = money;
            }
            
            NSString * validtime = [data objectForKey:@"validtime"];
            _Time.text = validtime;
        }else{
            [BDKNotifyHUD notifyHUDWithText:[data objectForKey:@"msg"]];
        }
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
